﻿package com.vicentediaz.view.menu
{
    import com.myp.share.*;
    import com.vicentediaz.data.*;
    import flash.display.*;
    import flash.events.*;

    public class SocialButtons extends Sprite
    {
        private var facebook:UtilButtonFacebook;
        private var base:Bitmap;
        private var twitter:UtilButtonTwitter;
        private var mySpace:UtilButtonMySpace;

        public function SocialButtons()
        {
            this.facebook = new UtilButtonFacebook();
            this.facebook.x = 1;
            addChild(this.facebook);
            this.twitter = new UtilButtonTwitter();
            this.twitter.x = this.facebook.x + this.facebook.width + 2;
            addChild(this.twitter);
            this.mySpace = new UtilButtonMySpace();
            this.mySpace.x = this.twitter.x + this.twitter.width + 2;
            addChild(this.mySpace);
            this.facebook.addEventListener(MouseEvent.CLICK, this.onFacebookClick, false, 0, true);
            this.twitter.addEventListener(MouseEvent.CLICK, this.onTwitterClick, false, 0, true);
            this.mySpace.addEventListener(MouseEvent.CLICK, this.onMySpaceClick, false, 0, true);
            return;
        }// end function

        private function onFacebookClick(param1:MouseEvent) : void
        {
            this.start();
            Share.facebook();
            return;
        }// end function

        private function start() : void
        {
            Share.url = Config.getInstance().getByValue("SHARE_URL");
            Share.title = "Vicente Diaz Website";
            return;
        }// end function

        private function onTwitterClick(param1:MouseEvent) : void
        {
            this.start();
            Share.twitter();
            return;
        }// end function

        private function onMySpaceClick(param1:MouseEvent) : void
        {
            this.start();
            Share.mySpace();
            return;
        }// end function

    }
}
